﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 只读字段
{
    public class DocumentEditor
    {
     
        public static readonly uint s_maxDocuments;//只读字段

        //静态构造函数或变量初始值中可以给只读字段赋值
        static DocumentEditor()
        {
            s_maxDocuments = DoSomethingToFindOutMaxNumber();
        }

        private static uint DoSomethingToFindOutMaxNumber()
        {
           return 666;
        }
    }
}
